import request from '@/utils/request'

const path = '/platform/min_app/douyin_open/'

/** *********************抖音服务商******************************************/

// 获取授权地址
export function getDouyinGenUrl(platform_app_id) {
  return request({
    url: path + 'getDouyinGenUrl',
    method: 'post',
    data: { platform_app_id }
  })
}

export function getDouyinAppInfo(platform_app_id) {
  return request({
    url: path + 'getDouyinAppInfo',
    method: 'post',
    data: { platform_app_id }
  })
}

// 获取小程序版本列表信息
export function getDouyinVersionsByAppId(platform_app_id) {
  console.log('platform_app_id', platform_app_id)
  return request({
    url: path + 'getDouyinVersionsByAppId',
    method: 'post',
    data: { platform_app_id }
  })
}

// 获取新版本信息
export function getDouyinNewVersion(platform_app_id) {
  return request({
    url: path + 'getDouyinNewVersion',
    method: 'post',
    data: { platform_app_id }
  })
}

/**
 * 提交代码
 * @param platform_app_id
 * @param desc
 * @returns {AxiosPromise}
 */
export function uploadDouyinVersion(platform_app_id, desc = '') {
  return request({
    url: path + 'uploadDouyinVersion',
    method: 'post',
    data: { platform_app_id, desc }
  })
}

// 获取二维码
export function getDouyinQrcode(platform_app_id, version = '') {
  return request({
    url: path + 'getDouyinQrcode',
    method: 'post',
    data: { platform_app_id, version }
  })
}

// 提交审核
export function auditDouyinVersion(platform_app_id, data) {
  return request({
    url: path + 'auditDouyinVersion',
    method: 'post',
    data: { platform_app_id, data }
  })
}

// 撤回审核
export function revokeAuditDouyinVersion(platform_app_id) {
  return request({
    url: path + 'revokeAuditDouyinVersion',
    method: 'post',
    data: { platform_app_id }
  })
}

// 发布代码
export function releaseDouyinVersion(platform_app_id) {
  return request({
    url: path + 'releaseDouyinVersion',
    method: 'post',
    data: { platform_app_id }
  })
}

// 获取绑定域名
export function getBindDomainForm(platform_app_id) {
  return request({
    url: path + 'getBindDomainForm',
    method: 'post',
    data: { platform_app_id }
  })
}
